package com.heima.user.controller;

import com.heima.common.dto.ResponseResult;
import com.heima.user.dto.AuthDto;
import com.heima.user.service.IApUserRealnameService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * APP实名认证信息表 前端控制器
 * </p>
 *
 * @author wsj
 * @since 2022-03-11
 */
@RestController
@RequestMapping("/api/v1/user_realname")
@Api(tags = "APP实名认证信息表接口")
public class ApUserRealnameController{

    @Autowired
    private IApUserRealnameService apUserRealnameService;

    /**
     * 根据状态查询用户审核列表
     * @param dto
     * @return
     */
    @ApiOperation(value = "根据状态查询用户审核列表",notes = "author:wsj")
    @ApiImplicitParam(name = "dto",value = "查询参数",required = true,dataType = "AuthDto")
    @PostMapping("/list")
    public ResponseResult list(@RequestBody AuthDto dto) {
        return apUserRealnameService.listByStatus(dto);
    }

    /**
     * 审核通过
     * @param dto
     * @return
     */
    @PostMapping("authPass")
    @ApiOperation(value = "审核通过",notes = "author:wsj")
    @ApiImplicitParam(name = "dto",value = "审核参数",required = true,dataType = "AuthDto")
    public ResponseResult authPass(@RequestBody AuthDto dto) {
        return  apUserRealnameService.authPass(dto,1);
    }

    /**
     * 审核驳回
     * @param dto
     * @return
     */
    @PostMapping("authFail")
    @ApiOperation(value = "审核驳回",notes = "author:wsj")
    @ApiImplicitParam(name = "dto",value = "审核参数",required = true,dataType = "AuthDto")
    public ResponseResult authFail(@RequestBody AuthDto dto) {
        return  apUserRealnameService.authPass(dto,0);
    }
}
